<extend name="public:template"/>
<block name="title">文章分类编辑</block>
<block name="content">
    <div class="wrap-page">
        <div id="pageMemberInfo" class="page-content">
            <form class="form default-style" role="form" action="{:u('backend/article_cate/edit')}" method="post">
                <input type="hidden" value="{$cate.id}" name="id">
                <div id="tabSwitchProduct" class="tab-switch">

                    <!--选项卡-->
                    <div class="tabs-title clearfix">
                        <ul>
                            <li class="current"><a data-id="tab-basic" href="javascript:;">基本信息</a></li>
                            <li><a data-id="tab-seo" href="javascript:;">{:L('article_seo')}</a></li>
                        </ul>
                    </div>
                    <!--选项卡-->

                    <!--编辑区域-->
                    <div class="tab-content">
                        <div id="tab-basic-content" class="tab-content-inner">
                            <div id="boxBasicInfo" class="box">
                                <div class="box-content">

                                    <dl class="clearfix">
                                        <dt><label>父级分类：</label></dt>
                                        <dd>
                                            <div class="item-field clearfix">
                                                <select class="form-control" name="pid">
                                                    <option value="0">一级分类</option>
                                                    {$select_menus}
                                                </select>
                                            </div>
                                        </dd>
                                    </dl>
                                    <dl class="clearfix">
                                        <dt><label>分类名称：</label></dt>
                                        <dd>
                                            <div class="item-field clearfix">
                                                <input id="cate_name" placeholder="请输入分类名称" class="textfield" type="text" value="{$cate.cate_name}" name="cate_name" autocomplete="off"/>
                                            </div>
                                        </dd>
                                    </dl>


                                    <dl class="clearfix">
                                        <dt><label>所属类型：</label></dt>
                                        <dd>
                                            <div class="item-field clearfix">
                                                <div class="radio-layout-h clearfix">
                                                    <div class="radio-item">
                                                        <span class="radio-field"><input class="radio" value="1" name="type" type="radio" <if condition="$cate.type eq 1"> checked="checked" </if> /></span>
                                                        <span class="radio-text"><label >文章栏目</label></span>
                                                    </div>
                                                    <div class="radio-item">
                                                        <span class="radio-field"><input class="radio"  value="2" name="type" type="radio" <if condition="$cate.type eq 2"> checked="checked" </if>/></span>
                                                        <span class="radio-text"><label >单页栏目</label></span>
                                                    </div>
                                                </div>
                                            </div>
                                        </dd>
                                    </dl>

                                    <dl class="clearfix">
                                        <dt><label>状态：</label></dt>
                                        <dd>
                                            <div class="item-field clearfix">
                                                <div class="radio-layout-h clearfix">
                                                    <div class="radio-item">
                                                        <span class="radio-field"><input class="radio" value="1" name="status" type="radio" <if condition="$cate.status eq 1"> checked="checked" </if> /></span>
                                                        <span class="radio-text"><label >是</label></span>
                                                    </div>
                                                    <div class="radio-item">
                                                        <span class="radio-field"><input class="radio"  value="0" name="status" type="radio" <if condition="$cate.status eq 0"> checked="checked" </if>/></span>
                                                        <span class="radio-text"><label >否</label></span>
                                                    </div>
                                                </div>
                                            </div>
                                        </dd>
                                    </dl>

                                </div>
                            </div>
                        </div>

                        <div id="tab-seo-content" class="tab-content-inner" style="display: none">
                            <div class="box">
                                <div class="box-content">
                                    <dl class="clearfix">
                                        <dt><label>{:L('seo_title')}：</label></dt>
                                        <dd>
                                            <div class="item-field clearfix">
                                                <input id="seo_title" placeholder="请输入{:L('seo_title')}"  class="textfield" type="text" name="seo_title" value="{$cate.seo_title}" />
                                            </div>
                                        </dd>
                                    </dl>

                                    <dl class="clearfix">
                                        <dt><label>{:L('seo_keys')}：</label></dt>
                                        <dd>
                                            <div class="item-field clearfix">
                                                <input id="seo_keys" placeholder="请输入{:L('seo_keys')}"  class="textfield" type="text" name="seo_keywords" value="{$cate.seo_keywords}" />
                                            </div>
                                        </dd>
                                    </dl>

                                    <dl class="clearfix">
                                        <dt><label>{:L('seo_desc')}：</label></dt>
                                        <dd>
                                            <div class="item-field clearfix">
                                                <textarea id="seo_description" placeholder="请输入{:L('seo_desc')}"  class="textarea" type="text" name="seo_description">{$cate.seo_description}</textarea>
                                            </div>
                                        </dd>
                                    </dl>

                                </div>
                            </div>
                        </div>
                    </div>
                    <!--编辑区域END-->
                </div>
                <div class="page-buttons clearfix">
                    <div class="fl-l">
                        <button type="button" class="button button-blue" id="save">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</block>
<block name="script">
    <script>
        $(document).ready(function(){

            $('#save').click(function(){
                var cate_name     = $.trim($('#cate_name').val());
                if(!cate_name)
                {
                    $('#cate_name').val('').focus();
                    layer.tips('请输入文章分类', '#cate_name', {
                        tips: [2, '#009f95'],
                        time: 2000
                    });
                    return false;
                }

                //数据验证
                $.ajax({
                    type: "POST",
                    url: $('.form').attr('action'),
                    data: $('.form').serialize(),
                    dataType: "json",
                    success:function(data){
                        if(data.status)
                        {
                            layer.msg(data.msg,{icon: 1,time:2000, shade: [0.1, '#ccc']},function(){
                            })
                        } else {
                            layer.msg(data.msg,{icon: 2,time:2000, shade: [0.1, '#ccc']})
                        }
                    }
                });
                return false;
            });
        });
    </script>
</block>